import request from '@/utils/request'

// 全局搜索
export function search(params) {
  return request({
    url: '/search',
    method: 'get',
    params
  })
}

// 获取搜索建议
export function getSuggestions(keyword) {
  return request({
    url: '/search/suggestions',
    method: 'get',
    params: { keyword }
  })
}

// 获取热门搜索关键词
export function getHotSearches() {
  return request({
    url: '/search/hot',
    method: 'get'
  })
}

// 记录搜索历史
export function recordSearch(keyword) {
  return request({
    url: '/search/record',
    method: 'post',
    data: { keyword }
  })
}

// 获取搜索历史
export function getSearchHistory() {
  return request({
    url: '/search/history',
    method: 'get'
  })
}

// 清除搜索历史
export function clearSearchHistory() {
  return request({
    url: '/search/history/clear',
    method: 'post'
  })
} 